import request from "../utils/request.js";

export const getStudentListApi =()=>{
    return request({
        url:"/student",
        method: "get",
    })
}

export const getStudentNameApi =(search)=>{
    return request({
        url:`/student`,
        method: "get",
        params:{
            search
        }
    })
}

export const addStudentApi =({name,age,gender, department})=>{
    return request({
        url:"/student/",
        method: "post",
        data:{
            name,
            age,
            gender,
            department
        }
    })
}

export const updateStudentApi =({id,name,age,gender, department})=>{
    return request({
        url:`/student/${id}`,
        method: "put",
        data:{
            name,
            age,
            gender,
            department
        }
    })
}

export const deleteStudentApi =(id)=>{
    return request({
        url:`/student/${id}`,
        method: "delete",
    })
}